package syswk.com.tanksgame;

import java.awt.*;
import java.util.Vector;

/**
 * 作者：swk
 * 时间：
 * 公司：
 **/
@SuppressWarnings({"all"})
public class Hero extends Tank {
    public Vector<Shot> shots = new Vector<>();

    public Hero(int x, int y, int direct, Boolean lift, Color color) {
        super(x, y, direct, lift, color);

    }

    public void shotEnemyTank() {
        Shot shot = null;
        if (shots.size() >= tankGames.HERO_SHOT_NUM) {
            return;
        }
        switch (getDirect()) {
            case 0:
                shot = new Shot(getX() + 20, getY(), 0, true, tankGames.HERO_SHOT_SPEED);
                break;
            case 1:
                shot = new Shot(getX() + 60, getY() + 20, 1, true, tankGames.HERO_SHOT_SPEED);
                break;
            case 2:
                shot = new Shot(getX() + 20, getY() + 60, 2, true, tankGames.HERO_SHOT_SPEED);
                break;
            case 3:
                shot = new Shot(getX(), getY() + 20, 3, true, tankGames.HERO_SHOT_SPEED);
                break;
        }
        shots.add(shot);
        new Thread(shot).start();

    }
}
